# -*- coding:utf-8 -*-

'''
PROJECT_NAME : python_高级
file    : desc
author  : 1032162439@qq.com
date    : 2022-11-08 11:19
IDE     : PyCharm
'''


class Descriptor:
    """
    描述符类
    """
    def __get__(self, instance, owner):
        print(self)
        print(instance)
        print(owner)

    def __set__(self, instance, value):
        print(self)
        print(instance)
        print(value)

    def __delete__(self, instance):
        print(self)
        print(instance)


class Hero:
    name = Descriptor()


def test_hero():
    luban = Hero()
    print("############__set__################")
    luban.name = '鲁班'
    print("************************************")
    print("############__get__################")
    luban.name
    print("************************************")
    print("############__delete__################")
    del luban.name
    print("************************************")



if __name__ == '__main__':
    test_hero()